package db.read;
import java.io.IOException;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapred.MapReduceBase;
import org.apache.hadoop.mapred.Mapper;
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class DBRecordMapper extends MapReduceBase implements Mapper<LongWritable, DBRecord, LongWritable, Text>{

    public static final Logger LOG = LoggerFactory.getLogger(DBRecord.class);
    @Override
    public void map(LongWritable key, DBRecord value,  
            OutputCollector<LongWritable, Text> collector, Reporter reporter)  
            throws IOException {
        LOG.info(value.toString());
        System.out.println(value.toString());
        collector.collect(new LongWritable(Long.valueOf(value.getId())), new Text(value.toString()));    
    }  
      
} 